from config import config

class RiskManager:
    def __init__(self):
        self.daily_pnl = 0
        self.max_loss = config.risk_params['max_loss_per_stock']

    def check_risk(self, symbol, position):
        # 单标的风控检查
        unrealized_pnl = position.unrealized_pnl
        if unrealized_pnl < -self.max_loss:
            return False
        # 其他风控逻辑...
        return True

    def check_account_risk(self):
        # 账户级风控
        total = self.daily_pnl
        if total < -config.risk_params['max_drawdown']:
            return False
        return True